<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <h1>ajax请求</h1>
    <script>
      const xhr = new XMLHttpRequest();
      xhr.onload = function () {
        if (xhr.status === 200 && xhr.readyState === 4) {
          console.log(xhr.responseText);
        }
      };
      let url = 'http://127.0.0.1:7000/api';
      xhr.open('get', url, true);
      xhr.send();
    </script>
  </body>
</html>
